package com.hzhk.happyrent.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.hzhk.happyrent.R;
import com.hzhk.happyrent.ui.activity.order.OrderListActivity;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class ResultPayActivity extends AppCompatActivity {

    @BindView(R.id.activity_titlebar_left)
    ImageView activityTitlebarLeft;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_result_pay);
        ButterKnife.bind(this);
    }

    @OnClick({R.id.activity_titlebar_left, R.id.pay_finish})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.activity_titlebar_left:
            case R.id.pay_finish:
                if("PayPeriodsActivity".equals(getIntent().getStringExtra("come_from"))){
                    finish();
                }else{
                    startActivity(new Intent(this, OrderListActivity.class));
                    finish();
                }
                break;
        }
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            if("PayPeriodsActivity".equals(getIntent().getStringExtra("come_from"))){
                finish();
            }else{
                startActivity(new Intent(this, OrderListActivity.class));
                finish();
            }
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }
}
